<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<script type="text/javascript">
	$(function() {

		
		// 注册dialog
		$("#index_regDialog").dialog({
			title : '注册',
			modal : true,
			buttons : [ {
				text : '注册',
				handler : function() {
					$('#index_regForm').form('submit');
				}
			} ]
		}).dialog('close');

		$("#index_regForm").form({
			url : '${pageContext.request.contextPath}/userAction!addUser.action',
			onSubmit : function() {
				return $(this).form('enableValidation').form('validate');
			},
			success : function(r) {
				var obj = jQuery.parseJSON(r);
				
				if(obj.success){
					$("#index_regDialog").dialog("close");
				}
				$.messager.show({
					title : '提示',
					msg : obj.msg
				});
			}
		});
		
		$("#index_regForm input").bind("keyup", function(event) {/* 增加回车提交功能 */
			if (event.keyCode == "13") {
				$("#index_regForm").submit();
			}
		});
	});
</script>
<div id="index_regDialog" class="easyui-dialog">
	<form id="index_regForm" method="post" data-options="novalidate:true">
		<table>
			<tr>
				<th>登录名</th>
				<td><input name="name" class="easyui-validatebox"
					data-options="required:true"></td>
			</tr>
			<tr>
				<th>密码</th>
				<td><input type="password" name="pwd"
					class="easyui-validatebox" data-options="required:true"></td>
			</tr>
			<tr>
				<th>重复密码</th>
				<td><input type="password" name="repwd"
					class="easyui-validatebox" data-options="required:true"
					validType="equals['#index_regForm input[name=pwd]']"></td>
			</tr>
		</table>
	</form>
</div>